{include file="public/header" /}
<div class="page">

        <form id="form" method="post" name="form1">
            <input type="hidden" name="id" value="{$id}" id="id"/>
            <table class="ds-default-table">
                <tbody>
                <tr>
                    <td colspan="2" class="required"><label class="validation">商品分类:</label>
                        <div id="gcategory" style="margin-left: 134px;margin-top:-20px;width: 447px;">
                            <input type="hidden" name="class_id"  class="mls_id" id="class_id"/>
                            <input type="hidden" name="class_name" class="mls_name" />
                            <select name="gcategory">
                            <option value="0">请选择</option>
                            {foreach name="gc_list" item="gc"}
                            <option value="{$gc.gc_id}">{$gc.gc_name}</option>
                            {/foreach}
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" ><label class="validation">商品品牌:</label>
                        <div  style='margin-left: 134px;' id="ajax_brand" class="dssc-brand-select w180">
                            <div class="selection">
                                <input style="margin-top:-16px;"  name="b_name" id="b_name" type="text"
                                       class="txt w180" readonly="readonly"/>
                                <input type="hidden" name="b_id" id="b_id" />
                            </div>
                            <div style="margin-top: -11px;" class="dssc-brand-select-container">
                                <div class="brand-index" style="width: 210px;padding-bottom: 10px;margin: 6px auto;border-bottom: dotted 1px #CCC;" data-url="{:url('Common/ajax_get_brand')}">
                                    <div class="letter" dstype="letter">
                                        <ul style="width: 100%;" >
                                            <li style="width: auto;" ><a href="javascript:void(0);" data-letter="all">所有品牌</a></li>
                                            <li style="width: auto;" ><a href="javascript:void(0);" data-letter="A">A</a></li>
                                            <li style="width: auto;" ><a href="javascript:void(0);" data-letter="B">B</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="C">C</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="D">D</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="E">E</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="F">F</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="G">G</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="H">H</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="I">I</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="J">J</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="K">K</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="L">L</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="M">M</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="N">N</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="O">O</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="P">P</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="Q">Q</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="R">R</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="S">S</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="T">T</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="U">U</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="V">V</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="W">W</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="X">X</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="Y">Y</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="Z">Z</a></li>
                                            <li style="width: auto;"><a href="javascript:void(0);" data-letter="0-9">其他</a></li>
                                        </ul>
                                    </div>
                                    <div class="search" dstype="search"><input name="search_brand_keyword" id="search_brand_keyword" type="text" class="text" /><a href="javascript:void(0);" class="dssc-btn-mini" style="vertical-align: top;">Go</a></div>
                                </div>
                                <div class="brand-list" dstype="brandList">
                                    <ul dstype="brand_list">
                                        {notempty name="brand_list"}
                                        {foreach name="brand_list" item="val"}
                                        <li data-id='{$val.brand_id}'data-name='{$val.brand_name}'  style="width: 500px;"><em>{$val.brand_initial}</em>{$val.brand_name}</li>
                                        {/foreach}
                                        {/notempty}
                                    </ul>
                                </div>
                                <div class="no-result" dstype="noBrandList" style="display: none;">暂无品牌信息</div>
                            </div>
                        </div>


                    </td>
                </tr>

                <tr class="control_after">
                    <td style="width: 100px;">
                        已选择品牌
                    </td>
                    <td>
                    </td>
                </tr>

                <tr>
                    <td colspan="2" class="required"><label class="validation">安装:</label>
                        <div style="margin-left: 134px;margin-top:-20px;width: 447px;">
                            <select name="anzhuang">
                                <option value="0">无</option>
                                <option value="1">了解</option>
                                <option value="2">熟练</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="required"><label class="validation">维修:</label>
                        <div style="margin-left: 134px;margin-top:-20px;width: 447px;">
                            <select name="weixiu">
                                <option value="0">无</option>
                                <option value="1">了解</option>
                                <option value="2">熟练</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="required"><label class="validation">保养:</label>
                        <div style="margin-left: 134px;margin-top:-20px;width: 447px;">
                            <select name="baoyang">
                                <option value="0">无</option>
                                <option value="1">了解</option>
                                <option value="2">熟练</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="required"><label class="validation">状态:</label>
                        <div style="margin-left: 134px;margin-top:-20px;width: 447px;">
                            <input name="status" type="radio" checked value="2">审核通过
                        </div>
                    </td>
                </tr>


                </tbody>
                <tfoot>
                <tr class="tfoot">
                    <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}" id="btn"/></td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<link rel="stylesheet" href="{$Think.CHAT_SITE_URL}/css/chat.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js" charset="utf-8"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.mousewheel.js"></script>
<script>
    $(function () {
        gcategoryInit('gcategory');
        $("#ajax_brand").brandinit();

    })

   $(document).ready(function () {
    $('ul[dstype="brand_list"]').prop("onclick","null").off("click");
        // 选择品牌
        $('ul[dstype="brand_list"]').on('click', 'li', function () {
            
        if($('#b_name').val().indexOf($(this).attr('data-name')+",") >=0){
            if($('#b_name').val()!=''){
                 return ;
            }
        }
        $('#b_id').val( $('#b_id').val() +  $(this).attr('data-id')+",");
        $('#b_name').val($('#b_name').val()  + $(this).attr('data-name') +",");
        
        var str = '<div  class = "control_list" style=" float: left; display: inline-block; margin-left:15px;>'; 
                    str += '<span class="thisoption"  >'+$(this).attr('data-name')+'</span>';
                    str += '<button type="button" style="margin-left: 10px;" class=" btn btn-small layui-btn-danger shanchu" style="background-color: #FF5722;" data-nid="'+$(this).attr('data-id')+'" data-name="' + $(this).attr('data-name')  +  '" >删除</button>';
                    str += '</div>';
                    $('.control_after td:eq(1)').append(str);
                
    $('.control_after').on('click', '.control_list button', function () {
          $('#b_id').val( $('#b_id').val().replace($(this).data("nid")+",",""));
          $('#b_name').val($('#b_name').val().replace($(this).data("name")+",","")); 
          $(this).parent().remove();
    });
                    


        return ;
    });

   });

    $('#btn').click(function () {
        // var baoyang = $('select[name="baoyang"]').val();
        // if(baoyang == 0){
        //     layer.msg('请选择保养');
        //     return false;
        // }
        // var anzhuang = $('select[name="anzhuang"]').val();
        // if(anzhuang == 0){
        //     layer.msg('请选择安装');
        //     return false;
        // }
        // var weixiu = $('select[name="weixiu"]').val();
        // if(weixiu == 0){
        //     layer.msg('请选择维修');
        //     return false;
        // }
        var b_id = $('#b_id').val();
        if(b_id == 0){
            layer.msg('请选择品牌');

            return false;
        }
        var class_id = $('#class_id').val();
        if(class_id == 0){
            layer.msg('请选择分类');
               
            return false;
        }
        var class_id = $('#class_id').val();
        if(class_id == 0 || class_id == ''){
            layer.msg('请选择分类');
            return false;
        }

    });

</script>